package com.zhongwang.mms.module.buy.controller;

import com.zhongwang.mms.base.BaseController;
import com.zhongwang.mms.common.JsonResult;
import com.zhongwang.mms.module.buy.model.ShoppingPlanModel;
import com.zhongwang.mms.module.buy.service.IntegrateQueryService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Description: 采购管理 -> 采购计划综合查询
 * 查看 -> buy:buyquery:view
 *
 * @Author: China.sgl
 * @Date: 2020/4/7 14:42
 */
@SuppressWarnings("ALL")
@Controller
@RequestMapping("/buy/integrateQuery")
public class IntegrateQueryController extends BaseController {

    @Autowired
    private IntegrateQueryService service;

    /**
     * 采购计划综合查询页面
     *
     * @return 路径
     */
    @GetMapping
    @RequiresPermissions({"buy:buyquery:view"})
    public String project() {
        return "buy/integrateQuery/page";
    }

    /**
     * 综合列表数据
     *
     * @param shoppingPlanModel 查询条件
     * @return list
     */
    @ResponseBody
    @PostMapping("/list")
    @RequiresPermissions({"buy:buyquery:view"})
    public JsonResult list(ShoppingPlanModel shoppingPlanModel) {
        startPage();
        List<ShoppingPlanModel> list = service.findIntegrate(shoppingPlanModel);
        return jsonResult(list);
    }

}
